package org.dt.common.sequence.dal;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.dt.common.sequence.Sequence;
import org.dt.common.sequence.persist.TransactionSeqMapper;

/**
 * <p>creation time: 2019/01/21 18:32</p>
 *
 * @author yujiadong
 **/
public interface PolicyTransactionSeqMapper extends PolicyBaseSeqMapper, TransactionSeqMapper {

    @Override
    @Select("select max_id+1 as lower_bound,max_id+#{step} as upper_bound from t_agr_sequence where agr_biz_code=#{biz}")
    Sequence getNextSequence(@Param("biz") String biz, @Param("step") long step);

    @Override
    @Update({"update t_agr_sequence set max_id=max_id+#{step} where agr_biz_code=#{biz}"})
    int updateMaxId(@Param("biz") String biz, @Param("step") long step);
}
